package com.iximo.client.desktop;

import net.oauth.OAuthConsumer;
import net.oauth.OAuthMessage;
import net.oauth.OAuthServiceProvider;
import net.oauth.client.OAuthClient;
import net.oauth.client.httpclient4.HttpClient4;

/**
 * oragenal desktop
 * @author Administrator1
 *
 */
public class Desktop {
	public static void main(String[] args) throws Exception {
		final OAuthServiceProvider provider = new OAuthServiceProvider(
				"http://www.douban.com/service/auth/request_token", 
				"http://www.douban.com/service/auth/authorize", 
				"http://www.douban.com/service/auth/access_token");
		final OAuthConsumer consumer = new OAuthConsumer( null, 
				"059ef56f6b705e1210dce04e42511a36", 
				"006ba4a489916c13", 
				provider);
//		final String serviceURL = "http://api.douban.com/people/ahbei";
		final String serviceURL = "http://www2.iximo.cc/smartphone/book.php?book_id=78";
		final DesktopClient client = new DesktopClient(consumer);
		client.setOAuthClient(new OAuthClient(new HttpClient4()));
		OAuthMessage response = client.accessWithNoAuth(OAuthMessage.GET, serviceURL, null);
		System.out.println(response.readBodyAsString());
	}
}
